//  program:	Minority Reports Multilevel Models
//  task:       Produce results from published JOP paper alternative modeling appendix found on dataverse
//  project:    Minority Reports
//  author:     Josh Ryan

// #Start
// program setup
// Notes:		The models herein replicate the multilevel models found in the supplemental analysis
//				here and on my academia website. The supplement explains various modeling issues, results, etc. 
clear all 
set linesize 80
macro drop _all
set seed 123456
set scheme s2mono

use "04workingrollcallandconferencedata041913.dta", clear

*Table 1
xtmixed krehbielwc minstate majoritysize2  chamdiff legprof_squire chambersize /// 
perconfvote numtotvot || statenu: chamber, mle var cov(un) /* column 1*/

xtmixed krehbielwc minstate majoritysize2 diffparty chamdiff legprof_squire chambersize numtot perconf /// 
hou_dem hou_rep sen_dem sen_rep || statenu: chamber, mle var cov(un) /* column 2*/

xtmixed krehbielwc minstate majoritysize2 diffparty chamdiff legprof_squire chambersize numtot perconf /// 
hou_dem hou_rep sen_dem sen_rep h_dist s_dist || statenu: chamber, mle var cov(un) /* column 3*/

xtmixed krehbielwc minstate majoritysize2 diffparty chamdiff legprof_squire chambersize numtot perconf /// 
h_dist s_dist if losingvote==0 || statenu: chamber, mle var cov(un) /* column 4*/



**************************Table 2
xtmixed krehbielwc i.minstate##c.chamdiff majoritysize2 diffparty chamdiff legprof_squire chambersize numtot perconf /// 
 || statenu: chamber, mle var cov(un) /* column 1*/

xtmixed krehbielwc i.minstate##c.chamdiff diffparty unifleg majoritysize2 legprof_squire chambersize /// 
perconfvote numtotvot h_dem_sd s_dem_sd h_rep_sd s_rep_sd  if losingvote==0|| statenu: chamber, mle var cov(un) /* column 2*/

xtmixed krehbielwc i.minstate##c.chamdiff i.unifleg majoritysize2 legprof_squire chambersize /// 
perconfvote numtotvot hou_dem hou_rep sen_dem sen_rep h_dist s_dist if unifleg==1|| statenu: chamber, mle var cov(un) /* column 3*/


******************Table 3

xtmelogit losingvote minstate majoritysize2 chamdiff legprof_squire chambersize /// 
perconfvote numtotvote || statenu: chamber, mle var cov(un)   /*column 1 */

xtmelogit losingvote minstate majoritysize2 diffparty unifleg legprof_squire chambersize numtot perconf /// 
   || statenu: chamber, mle var cov(un)  /*column 2*/
   
xtmelogit losingvote minstate majoritysize2 diffparty chamdiff legprof_squire chambersize numtot perconf /// 
hou_dem hou_rep sen_dem sen_rep h_dist s_dist || statenu: chamber, mle var cov(un) /*column 3*/
